home *** CD-ROM | disk | FTP | other *** search
- title 'extended character set for the EGA'
- name csls6
- page 55,132
-
- ;
- ; RAM-Loadable Character Sets for the IBM PC
- ; Listing 6
- ;
- ; Richard Wilton
- ; July 1986
- ;
-
- ; Notes:
- ; This program makes available two different 256-character definition
- ; tables for use in enhanced alphanumeric video display modes. The
- ; program assumes that the proper video mode has already been
- ; established.
- ;
- ; You must have at least 128K of RAM on your EGA to use this program.
- ;
- ; For IBM Enhanced Graphics Adapter ONLY. You should have a 350-line
- ; display to see the different character sizes.
-
-
- cset0 equ 0 ; character generator RAM bank #'s
- cset1 equ 1
-
-
- cseg segment para public 'CODE'
-
- assume cs:cseg,ds:cseg
-
- org 100h ; initial program counter for .COM file
-
- ; 1st 256 characters are 9x14 ROM characters (default for 350-line display)
- label0: mov bl,cset0 ; indicate bank 0 of char generator RAM
- ; (A000:0000 in bit plane 2)
- mov al,1 ; indicate 8x14 ROM characters
- mov ah,11h
- int 10h ; call BIOS to load character table
-
- ; 2nd 256 characters are 8x8 ROM character set
- mov bl,cset1 ; indicate bank 1 of char gen RAM
- ; (A000:4000 in bit plane 2)
- mov al,2 ; indicate 8x8 ROM characters
- mov ah,11h
- int 10h
-
- ; Enable attribute bit 3 selection of character set
- mov bl,(cset1 shl 2)+cset0 ; BL := value for Sequencer Character
- ; Map Select register
- mov al,3 ; "set block specifier"
- mov ah,11h
- int 10h ; call BIOS to program Sequencer
-
- ; Disable bit 3 of attribute byte for palette selection
- mov bh,7 ; bit mask
- mov bl,12h ; Attribute Controller: Color Plane
- ; Enable register number
- mov al,0 ; "individual palette register"
- mov ah,10h
- int 10h ; call BIOS to set register
-
- ; Display a message
- push cs
- pop ds
-
- mov si,offset csmsg0
- mov bl,7 ; bit 3 of attribute = 0
- mov cx,25 ; length of string
- call show ; display string using char set 0
-
-
- mov si,offset csmsg1
- mov bl,0Fh ; bit 3 of attribute = 1
- mov cx,25
- call show ; display string using char set 1
-
- ; Exit to DOS
- mov ax,4C00h
- int 21h
-
-
-
- ; Subroutine which displays a string using a given attribute
-
- show proc near ; Caller: DS:SI -> string
- ; CX = length of string
- ; BL = attribute
- jcxz show2
-
- show1: lodsb ; AL := next char
- push cx
- push bx
- call emit ; display this character
- pop bx
- pop cx
- loop show1
-
- show2: ret
-
- show endp
-
-
- ; Subroutine which displays a single character using a given attribute
-
- emit proc near ; Caller: AL = character
- ; BL = attribute
- ; Returns: nothing, but advances
- ; the cursor
- push bx
- push cx
-
- cmp al,20h
- jb emit1 ; jump if control character
-
- push ax ; save char on stack
- mov cx,1 ; CX := # of chars to write
- mov bh,0 ; BH := video display page 0
- mov ah,9 ; call BIOS to write attribute and
- int 10h ; character at cursor
- pop ax ; AL := character
-
- emit1: mov ah,0Eh ; call BIOS to rewrite character in
- int 10h ; "teletype mode" which advances
- ; the cursor
- pop cx
- pop bx
- ret
-
- emit endp
-
-
- ; Strings to be displayed
-
- csmsg0 db 'This is character set 0',0Dh,0Ah
- csmsg1 db 'This is character set 1',0Dh,0Ah
-
- cseg ends
-
- end label0